refactor(cli): tests construct Config directly - #216
Draft
ecalifornica wants to merge 1 commit into
Draft
Conversation
|
🔍 Preview deployed: https://5300407d.toolpath.pages.dev |
ecalifornica
force-pushed
the
robert/config-test-env
branch
from
August 14, 2026 19:49
d07bf68 to
566d3c1
Compare
The path-cli integration tests build a Config value against a tempdir instead of mutating the process environment. The Config fields are public so a separate test crate can construct one; Config::load stays the only production constructor. ScopedHome, the test environment locks, and the environment reads in test assertions are deleted. Test assertions derive their expected paths from the tempdir. Every Config field outside home and toolpath_config_dir stays None, so all seven harness resolvers root under the sandbox home. figment::Jail restores the variables it sets and serializes its own tests, so the three Jail tests need no extra lock.
ecalifornica
force-pushed
the
robert/config-test-env
branch
from
August 18, 2026 20:10
566d3c1 to
4962d9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #187. path-cli only. No library changes. No user-visible changes.
What
Configagainst aTestHometempdir and pass it torun_with_strategy. No test reads or mutates the process environment. Test assertions derive their expected paths from the tempdir.Configfields arepubso a test crate can construct one. The struct stays#[doc(hidden)];Config::loadis the only production constructor. Integration tests are separate crates and cannot see#[cfg(test)]items.ScopedHome,support::env_lock(),config::TEST_ENV_LOCK. Thefigment::Jailtests hold no extra lock: Jail serializes its own tests, and no other test touches the environment.Fixed sandbox escape
With
$XDG_DATA_HOMEset, the opencode resume test wrote into the developer's real~/.local/share/opencode/opencode.db: the guard pinned$HOME, butConfig::loadpicked up the real$XDG_DATA_HOMEand the resolver preferred it. A directly-constructedConfigcarries only sandbox paths (every field outsidehomeandtoolpath_config_dirisNone), so all seven harness resolvers root under the sandbox. Verified by running the suite with decoyXDG_DATA_HOMEandCOPILOT_HOMEvalues: the decoy directory stays empty.